/**
 * 字符串模板类型,可以限定邮箱账号、版本号之类的
 */

type SayHello<T extends string | number> = `Hello ${T}`;

type Greet1 = SayHello<"admin">; // "Hello admin"
const greet1:Greet1 = 'Hello admin';
type Greet2 = SayHello<599>; // "Hello 599"
const greet2:Greet2 = 'Hello 599'
const greetXxx:SayHello<string> = 'Hello xxxx'

type QQEmail = `${number}@qq.com`;
const qqEmail: QQEmail = '675198494@qq.com';

type Version = `${number}.${number}.${number}`;

const v1: Version = '1.1.0';
const v2: Version = '1.0.21'; // 报错：类型 "1.0" 不能赋值给类型 `${number}.${number}.${number}`
const v3: Version = 'a.0.0'; // 报错：类型 "a.0" 不能赋值给类型 `${number}.${number}.${number}`